package com.svs.generator.domain;

import java.util.List;

import com.svs.common.base.BaseEntity;
import com.svs.common.utils.StringUtils;
import com.svs.generator.helper.BizTableHelper;

/**
 * ry 数据库表
 * 
 * @author dujianqiao
 */
public class TableInfo extends BaseEntity<TableInfo> {
	
	private static final long serialVersionUID = 1L;

	/** 表名称 */
	private String tableName;

	/** 表描述 */
	private String tableComment;

	/** 表的主键列信息 */
	private ColumnInfo primaryKey;

	/** 表的列名(不包含主键) */
	private List<ColumnInfo> columns;

	/** 类名(第一个字母大写) */
	private String className;

	/** 类名(第一个字母小写) */
	private String classname;
	
	public int state = 0 ;

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getTableComment() {
		return tableComment;
	}

	public void setTableComment(String tableComment) {
		this.tableComment = tableComment;
	}

	public List<ColumnInfo> getColumns() {
		return columns;
	}

	public ColumnInfo getColumnsLast() {
		ColumnInfo columnInfo = null;
		if (StringUtils.isNotNull(columns) && columns.size() > 0) {
			columnInfo = columns.get(0);
		}
		return columnInfo;
	}

	public void setColumns(List<ColumnInfo> columns) {
		this.columns = columns;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getClassname() {
		return classname;
	}

	public void setClassname(String classname) {
		this.classname = classname;
	}

	public ColumnInfo getPrimaryKey() {
		return primaryKey;
	}

	public void setPrimaryKey(ColumnInfo primaryKey) {
		this.primaryKey = primaryKey;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}
	
	public String getStateName(){
		String name = "未同步" ;
		if(state == BizTableHelper.SYNCED) {
			name = "已同步" ;
		}
		return name ;
		
	}
	
}
